package com.fantasychong.myandroidapplication.base;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.fantasychong.myandroidapplication.R;
import com.fantasychong.myandroidapplication.constraintlayout.ConstraintLayoutActivity;
import com.fantasychong.myandroidapplication.recyclerView.RecyclerViewActivity;
import com.fantasychong.myandroidapplication.webview.WebViewActivity;

/**
 * Created by Fantasychong
 * Date: 2023/1/28
 */
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private Button rvBtn;
    private Button wbBtn;
    private Button clBtn;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initViews(); //配置组件
    }

    /**
     * 配置组件
     */
    private void initViews() {
        rvBtn= findViewById(R.id.main_rvBtn);
        wbBtn= findViewById(R.id.main_wbBtn);
        clBtn= findViewById(R.id.main_clBtn);

        rvBtn.setOnClickListener(this);
        wbBtn.setOnClickListener(this);
        clBtn.setOnClickListener(this);
    }

    /**
     * 点击监听
     */
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.main_rvBtn: //recyclerview
                startActivity(new Intent(this, RecyclerViewActivity.class));
                break;
            case R.id.main_wbBtn: //webview
                startActivity(new Intent(this, WebViewActivity.class));
                break;
            case R.id.main_clBtn: //constraintLayout
                startActivity(new Intent(this, ConstraintLayoutActivity.class));
                break;

        }
    }
}
